package org.huangrui.spark.java.sql;

import org.apache.spark.sql.SparkSession;

/**
 * @Author hr
 * @Create 2024-10-20 9:39
 */
public class SparkSQL03_SQL {
    public static void main(String[] args) {
        SparkSession spark = SparkSession.builder().appName("SparkSQL03_SQL").master("local[*]").getOrCreate();

        spark.read().json("data/user.txt").createOrReplaceTempView("user");

        // TODO 使用SQL文的方式操作数据
        spark.sql("select * from user").show();


        spark.stop();
    }
}
